<html>
<head><meta charset="utf-8"><title>VSCode installation error · t-compiler/rust-analyzer · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/index.html">t-compiler/rust-analyzer</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/VSCode.20installation.20error.html">VSCode installation error</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="184894419"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/VSCode%20installation%20error/near/184894419" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> mre <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/VSCode.20installation.20error.html#184894419">(Jan 06 2020 at 10:30)</a>:</h4>
<p>Hi,<br>
I wanted to install the latest version of rust analyzer for VSCode on macOS. <br>
Did a fresh clone of the repo and ran <code>cargo xtask install</code>.<br>
Then something weird happened. The server compiles without a hitch, but the extension doesn't:</p>
<div class="codehilite"><pre><span></span>will run: npm --version
6.13.4

will run: npm install
added 116 packages from 109 contributors and audited 201 packages in 2.732s

2 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities


will run: npm run package --scripts-prepend-node-path

will run: code --version
1.41.1
26076a4de974ead31f97692a0d32f90d735645c0
x64

will run: code --install-extension ./ra-lsp-0.0.1.vsix --force
Installing extensions...
ENOENT: no such file or directory, open &#39;/private/tmp/rust-analyzer/editors/code/ra-lsp-0.0.1.vsix&#39;
Failed Installing Extensions: ./ra-lsp-0.0.1.vsix
Error: install client

Caused by:
    `code --install-extension ./ra-lsp-0.0.1.vsix --force` exited with exit code: 1
</pre></div>


<p>The file is indeed not there. <code>code</code> and <code>cargo</code> are in my path, but I don't think that's relevant.</p>
<p>Inside <code>/editors/code</code>, I tried the following:</p>
<div class="codehilite"><pre><span></span>npm run package --verbose
npm info it worked if it ends with ok
npm verb cli [
npm verb cli   &#39;/Users/mendler/.volta/tools/image/node/12.14.0/6.13.4/bin/node&#39;,
npm verb cli   &#39;/Users/mendler/.volta/tools/image/node/12.14.0/6.13.4/bin/npm&#39;,
npm verb cli   &#39;run&#39;,
npm verb cli   &#39;package&#39;,
npm verb cli   &#39;--verbose&#39;
npm verb cli ]
npm info using npm@6.13.4
npm info using node@v12.14.0
npm verb run-script [ &#39;prepackage&#39;, &#39;package&#39;, &#39;postpackage&#39; ]
npm info lifecycle ra-lsp@0.0.1~prepackage: ra-lsp@0.0.1
npm info lifecycle ra-lsp@0.0.1~package: ra-lsp@0.0.1
npm info lifecycle ra-lsp@0.0.1~package: ignored because ignore-scripts is set to true ra-lsp@0.0.1
npm info lifecycle ra-lsp@0.0.1~postpackage: ra-lsp@0.0.1
npm verb exit [ 0, true ]
npm timing npm Completed in 108ms
npm info ok
</pre></div>


<p>but it doesn't create the <code>.vsix</code> file.<br>
Then I tried vsce:</p>
<div class="codehilite"><pre><span></span>vsce package
Executing prepublish script &#39;npm run vscode:prepublish&#39;...
 DONE  Packaged: /private/tmp/rust-analyzer/editors/code/ra-lsp-0.0.1.vsix (4 files, 13.69KB)
</pre></div>


<p>This creates the<code>.vsix</code>, but it's suspiciously small and only contains 4 files:</p>
<div class="codehilite"><pre><span></span>unzip -l ra-lsp-0.0.1.vsix
Archive:  ra-lsp-0.0.1.vsix
  Length      Date    Time    Name
---------  ---------- -----   ----
     1751  01-06-2020 11:26   extension.vsixmanifest
      245  01-06-2020 11:26   [Content_Types].xml
    41101  01-06-2020 11:07   extension/package-lock.json
    11740  01-06-2020 11:07   extension/package.json
---------                     -------
    54837                     4 files
</pre></div>


<p>Installing this extension works, but the commands don't exist.<br>
E.g. running <code>Rust Analyzer: Status</code> gives me</p>
<div class="codehilite"><pre><span></span>command &#39;rust-analyzer.analyzerStatus&#39; not found
</pre></div>


<p>The only thing I can think of is, that I'm using <a href="https://volta.sh/" target="_blank" title="https://volta.sh/">volta</a> as a node version manager.<br>
The node version gets correctly detected, however.<br>
Maybe anyone has an idea what I'm doing wrong.</p>



<a name="184894760"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/VSCode%20installation%20error/near/184894760" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/VSCode.20installation.20error.html#184894760">(Jan 06 2020 at 10:34)</a>:</h4>
<p>Hm..... My guess is that:</p>
<ul>
<li>either we somehow pick a "wrong" vsce (can you try <code>./node_modules/vscce/out/vsce</code>)</li>
<li>or vsce does not work for some reason (which I don't know how to bisect further)</li>
</ul>



<a name="184895316"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/VSCode%20installation%20error/near/184895316" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> mre <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/VSCode.20installation.20error.html#184895316">(Jan 06 2020 at 10:44)</a>:</h4>
<p>Same result:</p>
<div class="codehilite"><pre><span></span>./node_modules/vsce/out/vsce package
Executing prepublish script &#39;npm run vscode:prepublish&#39;...
 DONE  Packaged: /private/tmp/rust-analyzer/editors/code/ra-lsp-0.0.1.vsix (4 files, 13.69KB)
</pre></div>



<a name="184895423"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/VSCode%20installation%20error/near/184895423" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> mre <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/VSCode.20installation.20error.html#184895423">(Jan 06 2020 at 10:46)</a>:</h4>
<p>Huh, it works with yarn...</p>
<div class="codehilite"><pre><span></span>./node_modules/vsce/out/vsce package --yarn
Executing prepublish script &#39;yarn run vscode:prepublish&#39;...
yarn run v1.21.1
$ rollup -c
Done in 4.14s.
warning ra-lsp@0.0.1: The engine &quot;vscode&quot; appears to be invalid.

src/main.ts → ./out/main.js...
created ./out/main.js in 2.6s
 DONE  Packaged: /private/tmp/rust-analyzer/editors/code/ra-lsp-0.0.1.vsix (5 files, 108.09KB)
</pre></div>



<a name="184895455"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/VSCode%20installation%20error/near/184895455" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/VSCode.20installation.20error.html#184895455">(Jan 06 2020 at 10:47)</a>:</h4>
<p>Second hypothesis: <code>vsce</code> picks the wrong <code>rollup</code> (see <code>vsce:preblushin</code> in package.json)</p>



<a name="184895554"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/VSCode%20installation%20error/near/184895554" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> mre <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/VSCode.20installation.20error.html#184895554">(Jan 06 2020 at 10:48)</a>:</h4>
<p>Shouldn't then the yarn build also fail?</p>



<a name="184895600"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/VSCode%20installation%20error/near/184895600" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/VSCode.20installation.20error.html#184895600">(Jan 06 2020 at 10:49)</a>:</h4>
<p>I can see how <code>yarn</code> and <code>npm</code> might pick different binaries</p>



<a name="184895658"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/VSCode%20installation%20error/near/184895658" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/VSCode.20installation.20error.html#184895658">(Jan 06 2020 at 10:50)</a>:</h4>
<p>To clarify, we do install <code>rollup</code> as a dev-dependency, and it's version is pinned, so tools <em>should</em> pick up that</p>



<a name="184895675"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/VSCode%20installation%20error/near/184895675" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/VSCode.20installation.20error.html#184895675">(Jan 06 2020 at 10:50)</a>:</h4>
<p>But we already had a bug where npm picked a global binary withotu a special flag</p>



<a name="184895710"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/VSCode%20installation%20error/near/184895710" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/VSCode.20installation.20error.html#184895710">(Jan 06 2020 at 10:51)</a>:</h4>
<p>Actually, it might be the same exact bug in <code>vsce</code>? It doesn't set <code>--scripts-prepend-node-path</code> which leaks global env?</p>



<a name="184896025"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/VSCode%20installation%20error/near/184896025" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> mre <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/VSCode.20installation.20error.html#184896025">(Jan 06 2020 at 10:56)</a>:</h4>
<p>Hum...<br>
Don't have rollup installed globally, I guess.</p>
<div class="codehilite"><pre><span></span>npm list -g --depth=0
/Users/mendler/.volta/tools/image/node/12.14.0/6.13.4/lib
└── npm@6.13.4
</pre></div>


<div class="codehilite"><pre><span></span>yarn global list
yarn global v1.21.1
✨  Done in 0.06s.
</pre></div>



<a name="184896170"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/VSCode%20installation%20error/near/184896170" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/VSCode.20installation.20error.html#184896170">(Jan 06 2020 at 10:58)</a>:</h4>
<p>Hm...</p>
<p>But it seems like we still can narrow the problem down to just rollup, right? Ie, do <code>npm run vscode:prepublish</code> and <code>yarn run vscode:prepublish</code> differ? prepublish is just <code>rollup -c</code></p>



<a name="184896417"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/VSCode%20installation%20error/near/184896417" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> mre <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/VSCode.20installation.20error.html#184896417">(Jan 06 2020 at 11:02)</a>:</h4>
<div class="codehilite"><pre><span></span>rust-analyzer/editors/code on master is v0.0.1 via ⬢ v12.14.0 ❯❯❯ npm run vscode:prepublish
rust-analyzer/editors/code on master is v0.0.1 via ⬢ v12.14.0 ❯❯❯ yarn run vscode:prepublish
yarn run v1.21.1
warning ra-lsp@0.0.1: The engine &quot;vscode&quot; appears to be invalid.
$ rollup -c

src/main.ts → ./out/main.js...
created ./out/main.js in 2.4s
✨  Done in 3.00s.
rust-analyzer/editors/code on  master is v0.0.1 via ⬢ v12.14.0 took 3s ❯❯❯ rollup -c
zsh: command not found: rollup```
</pre></div>



<a name="184896433"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/VSCode%20installation%20error/near/184896433" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> mre <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/VSCode.20installation.20error.html#184896433">(Jan 06 2020 at 11:02)</a>:</h4>
<p>Looks like npm swallows the error.</p>



<a name="184896977"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/VSCode%20installation%20error/near/184896977" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> mre <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/VSCode.20installation.20error.html#184896977">(Jan 06 2020 at 11:08)</a>:</h4>
<p>Well, there is this is in the verbose output: <code>npm info lifecycle ra-lsp@0.0.1~vscode:prepublish: ignored because ignore-scripts is set to true ra-lsp@0.0.1</code></p>



<a name="184897119"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/VSCode%20installation%20error/near/184897119" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> mre <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/VSCode.20installation.20error.html#184897119">(Jan 06 2020 at 11:10)</a>:</h4>
<p>After running <code>npm config set ignore-scripts false</code> I get the same output now.</p>



<a name="184897200"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/VSCode%20installation%20error/near/184897200" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/VSCode.20installation.20error.html#184897200">(Jan 06 2020 at 11:11)</a>:</h4>
<p>Hm, yeah, our installation will not work with <code>--ignore-scripts</code></p>



<a name="184897261"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/VSCode%20installation%20error/near/184897261" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> mre <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/VSCode.20installation.20error.html#184897261">(Jan 06 2020 at 11:12)</a>:</h4>
<p>No clue why it was set, to be honest. <span aria-label="laughing" class="emoji emoji-1f606" role="img" title="laughing">:laughing:</span></p>



<a name="184897274"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/VSCode%20installation%20error/near/184897274" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/VSCode.20installation.20error.html#184897274">(Jan 06 2020 at 11:12)</a>:</h4>
<p>Is there a way to make <code>npm</code> fail with <code>--ignore-scripts</code>? Quietly ignoring it and producing a pacakge without javascript is not a very helpful behavior :-)</p>



<a name="184897579"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/VSCode%20installation%20error/near/184897579" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> mre <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/VSCode.20installation.20error.html#184897579">(Jan 06 2020 at 11:17)</a>:</h4>
<p>One thing that comes to mind is that we could check the return value of  <code>npm config get ignore-scripts</code> ourselves and print an error message if it's <code>true</code>.</p>



<a name="184917133"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/VSCode%20installation%20error/near/184917133" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> mre <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/VSCode.20installation.20error.html#184917133">(Jan 06 2020 at 15:42)</a>:</h4>
<p>Could create an issue to follow up that discussion if you like. Anyway, thanks for helping me out here. :)</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>